import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: 'Type',
    align: "center",
    sorter: true,
    dataIndex: 'typ_dictText'
  },
  {
    title: 'Period',
    align: "center",
    sorter: true,
    dataIndex: 'version'
  },
  {
    title: 'Current',
    align: "center",
    sorter: true,
    dataIndex: 'iscurrent_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "Type",
    field: 'typ',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "mp_datatype"
    },
    colProps: {span: 6},
  },
  {
    label: "Period",
    field: 'version',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "Current",
    field: 'iscurrent',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: 'Type',
    field: 'typ',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "mp_datatype"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入Type!'},
             ];
    },
  },
  {
    label: 'Period',
    field: 'version',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入Period!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
